<?php
namespace collectresult;



class pk10{
	/*
	** 二维数组
	** $params 二维数组
	** 字段列表 必须包含
	** typeid 彩票种类（ssc,k3,Game,kl10f,pk10,keno,xy28）
	** playid 玩法标识
	** opencode 开奖号码
	** tzcode 投注号码
	*/
    function check($symbol){
        $arrs = self::$symbol();
        return $arrs;
    }
	//幸运飞艇
	function xyft (){
        //游戏飞艇
        $arrs=[];
        $res = "http://api.caipiaokong.cn/lottery/?name=xyft&format=json&uid=1369988&token=fd2493980afc452c799a031546d6e33c6937a79f&num=20";
        $ch = curl_init();
        curl_setopt($ch, CURLOPT_URL, $res);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($ch, CURLOPT_BINARYTRANSFER, true); // 在启用 CURLOPT_RETURNTRANSFER 时候将获取数据返回
        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);// 开启使用SSL
        $result = curl_exec($ch);
        curl_close($ch);
        if (!empty($result)) {
            $result = json_decode($result, true);
            //dump($result);
            ksort($result);

            foreach ($result as $k => $v) {

                $data = array(
                    'lottery_id' => 3,
                    'round' => $k,
                    'day_round' => substr($k, -2),
                    'number' => $v['number'],
                    'dateline' => $v['dateline'],
                    'create_time' => time(),
                    'source' => '第三方采集',
                    'cate_id' => 1
                );

               $arrs[]=$data;

            }
        }
        return $arrs;
    }


    //北京pk10

    function fh (){
        //北京pk10
        $arrs=[];
        $res = "http://api.caipiaokong.cn/lottery/?name=bjpks&format=json&uid=1369988&token=fd2493980afc452c799a031546d6e33c6937a79f&num=30";
        $ch = curl_init();
        curl_setopt($ch, CURLOPT_URL, $res);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($ch, CURLOPT_BINARYTRANSFER, true); // 在启用 CURLOPT_RETURNTRANSFER 时候将获取数据返回
        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);// 开启使用SSL
        $result = curl_exec($ch);
        curl_close($ch);
        if (!empty($result)) {
            $result = json_decode($result, true);
            //dump($result);
            ksort($result);

            foreach ($result as $k => $v) {

                $data = array(
                    'lottery_id' => 1,
                    'round' => $k,
                    'day_round' => substr($k, -2),
                    'number' => $v['number'],
                    'dateline' => $v['dateline'],
                    'create_time' => time(),
                    'source' => '第三方采集',
                    'cate_id' => 1
                );

                $arrs[]=$data;

            }
        }
        return $arrs;
    }




    //澳洲pk10

    function azpk (){
        //北京pk10
        $arrs=[];
        $res = "http://main.caipiaoapi.com:7373/hall/nodeService/api_request?uid=2376&time=1589194474&gamekey=azxy10&api=apiGameList&md5=e5c2935fb1b522519ac024b36ea54571&site=api.jiekouapi.com";
        $ch = curl_init();
        curl_setopt($ch, CURLOPT_URL, $res);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($ch, CURLOPT_BINARYTRANSFER, true); // 在启用 CURLOPT_RETURNTRANSFER 时候将获取数据返回
        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);// 开启使用SSL
        $result = curl_exec($ch);
        curl_close($ch);
        if (!empty($result)) {
            $result = json_decode($result, true);
            if($result['errorCode']==0){

                foreach ($result['result']['data'] as $k => $v) {

                    $data = array(
                        'lottery_id' => 22,
                        'round' => $v['gid'],
                        'day_round' => 0,
                        'number' => $v['award'],
                        'dateline' => $v['time'],
                        'create_time' => time(),
                        'source' => '第三方采集',
                        'cate_id' => 1
                    );

                    $arrs[]=$data;

                }
            }


        }
        return $arrs;
    }






}
?>